/**
 * <p>Title: ServiceZM9V.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 高强
 * @version 1.0
 * <pre>Histroy:
 *          2012-12-18下午13:18:02  高强  Create
 *</pre>
 */
package com.baosight.sczx.zm.service;

import java.util.HashMap;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.zm.domain.ZM9V;

/**
 * 材料日清日结
 * <p>Title: ServiceZM9V.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 高强
 * @version 1.0
 * <pre>Histroy:
 *          2012-12-18下午13:18:02  高强  Create
 *</pre>
 */
public class ServiceZM9V extends ServiceEPBase {

	/**
	 * 初始化
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZM9V</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-12-13下午13:46:05 高强
	 * </p>
	 *
	 */
	@Override
	public EiInfo initLoad(EiInfo inInfo) {	
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		return query(inInfo);		
	}
	
	/**
	 * 查询
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZM9V</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *     2012-12-13下午13:46:05 高强
	 * </p>
	 *
	 */
	@Override
	public EiInfo query(EiInfo inInfo) {
		EiInfo outInfo = new EiInfo();
		Map map = new HashMap();
		map.put("year", StaticTools.getYear());
		map.put("month", Integer.parseInt(StaticTools.getMonth()));
		outInfo.addBlock("result").addBlockMeta(getMeta());
		outInfo.getBlock("result").addRows(dao.query("ZM9V.query", map));
		return outInfo;
	}
	
	/**
	 * 构造列
	 * <p>Function: getMeta</p>
	 * <p>Description: </p>
	 * <p>return value:EiBlockMeta</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-12-12上午05:46:20 张志芳
	 * </p>
	 *
	 */
	private EiBlockMeta getMeta()
	{
		EiBlockMeta eiMetadata = new EiBlockMeta();
		EiColumn eiColumn = new EiColumn("fdMaterialCode");
		eiColumn.setFieldLength(40);	
		eiColumn.setDescName("物资编码");
		eiMetadata.addMeta(eiColumn);

		
		eiColumn = new EiColumn("fdMaterialName");
		eiColumn.setFieldLength(80);	
		eiColumn.setDescName("物资名称");
		eiMetadata.addMeta(eiColumn);

		
		eiColumn = new EiColumn("fdSpecModel");
		eiColumn.setFieldLength(100);	
		eiColumn.setDescName("规格型号");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdNumber");
		eiColumn.setFieldLength(100);	
		eiColumn.setDescName("图号");
		eiMetadata.addMeta(eiColumn);

		
		eiColumn = new EiColumn("fdNum");
		eiColumn.setType("N");
		eiColumn.setScaleLength(2);
		eiColumn.setFieldLength(20);
		eiColumn.setDescName("库存数量");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdExportNum");
		eiColumn.setType("N");
		eiColumn.setScaleLength(10);
		eiColumn.setFieldLength(20);
		eiColumn.setDescName("出库数量");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdImportNum");
		eiColumn.setType("N");
		eiColumn.setScaleLength(10);
		eiColumn.setFieldLength(20);
		eiColumn.setDescName("入库数量");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdPrice");
		eiColumn.setType("N");
		eiColumn.setScaleLength(10);
		eiColumn.setFieldLength(20);
		eiColumn.setDescName("单价");
		eiMetadata.addMeta(eiColumn);
		
		return eiMetadata;
	}
}
